from django.db import models

class Zakaznik(models.Model):
	id = models.IntegerField(primary_key=True)
	prijmeni = models.CharField(maxlength=50)
	jmeno = models.CharField(maxlength=50)
	mesto = models.CharField(maxlength=100)
	ulice = models.CharField(maxlength=100)
	psc = models.CharField(maxlength=5)
	telefon = models.CharField(maxlength=25)

	class Admin:
		pass
class Zamestnanec(models.Model):
	id = models.IntegerField(primary_key=True)
	prijmeni = models.CharField(maxlength=50)
	jmeno = models.CharField(maxlength=50)
	mesto = models.CharField(maxlength=100)
	ulice = models.CharField(maxlength=100)
	psc = models.CharField(maxlength=5)
	rc = models.CharField(maxlength=11)

class Zakazka(models.Model):
	id = models.IntegerField(primary_key=True)
	zakaznik = models.ForeignKey('Zakaznik')
	spz = models.CharField(maxlength=16)
	popis = models.TextField()

	class Admin:
		pass

class Ukon_sazebnik(models.Model):
	id = models.IntegerField(primary_key=True)
	sazebnik = models.ForeignKey('Sazebnik')
	stav = models.ForeignKey('Stav_ukonu')
	poznamka = models.TextField()
	zakazka = models.ForeignKey('Zakazka')

class Stav_ukonu(models.Model):
	id = models.IntegerField(primary_key=True)
	nazev = models.CharField(maxlength=30)

class Soubory_oprav(models.Model):
	id = models.IntegerField(primary_key=True)
	nazev = models.CharField(maxlength=100)
	sazebnik = models.ManyToManyField('Sazebnik')

class Sazebnik(models.Model):
	id = models.IntegerField(primary_key=True)
	nazev_ukonu = models.CharField(maxlength=50)
	popis = models.TextField()
	cena = models.FloatField(max_digits=6, decimal_places=2)

class Prace_na_ukonu(models.Model):
	id = models.IntegerField(primary_key=True)
	zamestnanec = models.ForeignKey('Zamestnanec')
	ukon = models.ForeignKey('Ukon_sazebnik') 
	zacatek = models.DateTimeField('zacatek prace')
	konec = models.DateTimeField('konec prace')
	


